package cn.mazexal.examapi.common.models;

import java.util.Objects;

/**
 * @author: Mazexal
 * Date: 2025/5/11
 */
public abstract class BaseIdentifier<T> implements Identifier<T> {
    protected T value;

    private BaseIdentifier() {
    }

    public BaseIdentifier(T value) {
        this.value = value;
    }

    public T getValue() {
        return this.value;
    }

    public boolean equals(Object object) {
        if (this == object) {
            return true;
        } else if (object instanceof BaseIdentifier) {
            BaseIdentifier<?> that = (BaseIdentifier)object;
            return Objects.equals(this.getValue(), that.getValue());
        } else {
            return false;
        }
    }

    public int hashCode() {
        return Objects.hashCode(this.getValue());
    }

    public String toString() {
        return String.valueOf(this.value);
    }
}

